<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .commission{margin:12px 0}
    .ruleConfig{display:block;background-color:#20ab4f;float:right;color:#FFF;padding:0 10px;margin:5px 10px;height:24px;line-height:24px;cursor:pointer;}
    .commission_1,.commission_2,.commission_total{display: block;margin-top: 10px;width:100%;height:25px;line-height:25px;}
    .commission_total{text-align:left;}
    .commission_2{margin-left:0px;clear:both;}
    .commission_input{border: 1px solid #d7d7d7;float: left;height: 24px;line-height: 24px;margin: 0 10px 10px 0;text-align: center;width: 150px;}
    #c_type{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 130px 5px;border: 1px solid #d7d7d7;color: #666;
        float: left;font-family: "微软雅黑";height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 154px;}
    .xiaci1{
        background: rgba(0, 0, 0, 0) url("{:get_style_cdnurl()}/paimai/yunying/images/zhong_pic.jpg") no-repeat scroll 130px 4px;border: 1px solid #d7d7d7;float: left;
        height: 24px;line-height: 24px;margin-right: 10px;padding-left: 10px;text-align: left;width: 140px;padding-right:28px;}
    .table thead tr > td
    ,.table tbody tr>td {text-align: center;vertical-align:middle; }
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="jjr.hbgl" />
    <div class="mianR">
        <h3 class="cha">红包管理<span onclick="location.href='/Commission/rule_config'" class="ruleConfig">规则配置</span></h3>
        <div class='commission yuSuo clearfix'>
            <form id="searchFrom">
                <div class="commission_1">
                    <input type="text" name="c_id" placeholder="请输入红包ID" class="commission_input"/>
                    <select name="c_type" id="c_type">
                        <option value="">全部红包类型</option>
                        <option value="1">发展红包</option>
                        <option value="2">直接红包</option>
                        <option value="3">间接红包</option>
                        <option value="4">邀请注册</option>
                    </select>
                    <input type="text" name="agent_uid" placeholder="请输入经纪人ID" class="commission_input"/>
                    <input type="text" name="agent_phone" placeholder="请输入经纪人手机号" class="commission_input"/>
                    <input type="text" name="car_no" placeholder="请输入车辆ID" class="commission_input"/>
                </div>
                <div class="commission_2">
                    <input type="text" name="start_time" placeholder="开始时间" value="" class="xiaci1 xin-text" id="commission_start_time" readonly>
                    <input type="text" name="end_time"  placeholder="结束时间" value="" class="xiaci1 xin-text" id="commission_end_time" readonly />
                    <input class="suoSou" type="button" name="commission_search" value="筛选">
                    <input class="suoSou" type="button" name="commission_all" value="全部" onclick="window.location.href='/Commission/index'">
                </div>
            </form>
        </div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<script type="text/javascript">
    //获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null)
            return unescape(r[2]);
        return null; //返回参数值
    }
    get_list();
    function get_list() {
        var url = mkUrl();
        var p = getUrlParam('p');
        if (p != null) {
            var purl = "?p=" + p;
        } else {
            var purl = "?p=1";
        }
        $.get("/Commission/commission_list" + purl, url, function (data) {
            $("#listBox").html(data);
        }, "html");
    }
    function get_page(p) {
        var url = mkUrl();
        $.get("/Commission/commission_list/" + encodeURI("p/" + p), url, function (data) {
            $("#listBox").html(data);
        }, "html");
    }
    $("input[name='commission_search']").click(function () {
        get_list();
    });
    function mkUrl() {
        var url = "";
        var c_id = $("input[name='c_id']").val();
        var c_type = $("#c_type").val();
        var agent_uid = $("input[name='agent_uid']").val();
        var agent_phone = $("input[name='agent_phone']").val();
        var car_no = $("input[name='car_no']").val();
        var start_time = $("input[name='start_time']").val();
        var end_time = $("input[name='end_time']").val();
        if (c_id) {
            url += '&c_id=' + c_id;
        }
        if (c_type) {
            url += '&c_type=' + c_type;
        }
        if (agent_uid) {
            url += '&agent_uid=' + agent_uid;
        }
        if (agent_phone) {
            url += '&agent_phone=' + agent_phone;
        }
        if (car_no) {
            url += '&car_no=' + car_no;
        }
        if (start_time) {
            url += '&start_time=' + start_time;
        }
        if (end_time) {
            url += '&end_time=' + end_time;
        }
        return url;
    }
    $("#commission_start_time").ymdateplugin({
//        showTimePanel: true,
//        changeMonth: true,
//        changeYear: true
    });
    $("#commission_end_time").ymdateplugin({
//        showTimePanel: true,
//        changeMonth: true,
//        changeYear: true
    });
</script>
<include file="Public/foot" />
